﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CID.Domain.Operations;
using Rhino.Mocks;
using CID.Domain.Infrastructure;

namespace CID.Domain.Tests.Operations
{
    static class StubsBuilder
    {
        public static IServer BuildServerStub()
        {
            var result = MockRepository.GenerateStub<IServer>();
            return result;
        }

        public static IServerRole BuildServerRoleStub()
        {
            var result = MockRepository.GenerateStub<IServerRole>();
            return result;
        }

        public static IEnvironment BuildEnvironmentStub()
        {
            var result = MockRepository.GenerateStub<IEnvironment>();
            return result;
        }

        public static ILocation BuildLocationStub(IDeploymentAgent deploymentAgent = null)
        {
            var result = MockRepository.GenerateStub<ILocation>();
            result.DeploymentAgent = deploymentAgent;
            return result;
        }

        public static IServerAssignment BuildServerAssignmentStub(IEnvironment environment = null, IServer server = null, IServerRole serverRole = null)
        {
            var result = MockRepository.GenerateStub<IServerAssignment>();
            result.Stub(x => x.Environment).Return(environment);
            result.Stub(x => x.Server).Return(server);
            result.Stub(x => x.ServerRole).Return(serverRole);
            return result;
        }


        public static IDeploymentAgent BuildDeploymentAgentStub()
        {
            return MockRepository.GenerateStub<IDeploymentAgent>();
        }
    }
}
